package com.vortex.cloud.sample.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.vortex.cloud.vfs.lite.base.dto.AbstractBaseDTO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;

/**
 * @author 王林
 * @version 1.0
 * @date 2021-10-13 周三
 * @time 15:04
 * @description
 */
@Data
@Schema(name = "TaskUserDTO", title = "Task用户信息表", description = "用户信息表")
@EqualsAndHashCode(callSuper = true)
public class TaskUserDTO extends AbstractBaseDTO {

    /**
     * 姓名
     */
    @NotBlank(message = "姓名不能为空")
    @Schema(name = "name", description = "姓名")
    private String name;

    /**
     * 日期
     */
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @Schema(description = "日期")
    private LocalDate taskDate;

    /**
     * 时间
     */
    @JsonFormat(pattern = "HH:mm:ss", timezone = "GMT+8")
    @Schema(description = "时间")
    private LocalTime taskTime;

    /**
     * 年月日时分秒
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Schema(description = "年月日时分秒")
    private LocalDateTime taskDateTime;

    /**
     * 用户类型，0：管理员，1：普通用户
     */
    @NotNull(message = "用户类型不能为空")
    @Schema(description = "用户类型,0:管理员，1:普通用户")
    private String roleType;

    /**
     * 身份证号
     */
    @NotBlank(message = "身份证号不能为空")
    @Schema(description = "身份证号")
    private String idNo;

    /**
     * 性别，1：男,0：女 -参见Position枚举
     */
    @NotBlank(message = "身份证号不能为空")
    @Pattern(regexp = "^\\d{15}|\\d{18}$", message = "身份证为15或18位")
    @Schema(description = "性别")
    private String sex;

    /**
     * 手机号
     */
    @NotBlank(message = "手机号不能为空")
    @Pattern(regexp = "^1[0-9]{10}$", message = "手机号码错误")
    @Schema(description = "手机号")
    private String mobileNo;

    /**
     * 职位，参见Position枚举
     */
    @NotBlank(message = "职位不能为空")
    @Schema(description = "职位，参见Position枚举")
    private String position;

    /**
     * 邮箱
     */
    @Schema(description = "邮箱")
    @NotBlank(message = "邮箱号不能为空")
    @Pattern(regexp = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$", message = "邮箱格式为xxx@xx.xx")
    private String email;

    /**
     * 登录凭证
     */
    @Schema(description = " 登录凭证")
    private String loginToken;

    /**
     * 是否首次登录，参见YesOrNo枚举
     */
    @Schema(description = "是否首次登录")
    private String isFirstLogin;

    /**
     * 头像地址
     */
    @Schema(description = " 头像地址")
    private String logoUrl;

    /**
     * 备注
     */
    @Schema(description = " 备注")
    private String remark;

}
